﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DataAccess;
using Entities;
using BusinessFacade;

namespace MedicareNoteManagerWeb.Web
{
    public partial class MainForm :BasePage
    {
        private sys_user_Model model;
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!Page.IsPostBack)
            {
                model = (sys_user_Model)Session["UserModel"];
                LoadMenu();
            }
        }
        public void LoadMenu()
        {
            DataTable ds = new DataTable();
            ds = new Busi_sys_Menu().GetFunctionmenu(model.UserID);
            this.Repeater1.DataSource = ds;
            this.Repeater1.DataBind();
        }

        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            DataRowView dr;
            dr = (DataRowView)e.Item.DataItem;
            Repeater rp;
            rp = (Repeater)e.Item.FindControl("Repeater2");
            rp.DataSource = new Busi_sys_Menu().GetTwoFunctionmenu(model.UserID, int.Parse(dr["MenuID"].ToString()));
            rp.DataBind();
        }
    }
}